
Namespace BusinessLogicLayer

    Public Class NetworkUser

        Private _UserID As String
        Private _UserName As String
        Private _LastLogin As Date
        Private _MainFilter As String
        Private _TaskFilter As String

        Public Sub Save()
            Try
                Dim dt As DataTable = BusinessLogicLayer.SystemObjects.GetUserProperties(_UserID)
                dt.Rows(0).Item(Globals.UserProperties.UserName.ToString) = _UserName
                dt.Rows(0).Item(Globals.UserProperties.LastLogin.ToString) = _LastLogin
                dt.Rows(0).Item(Globals.UserProperties.MainFilter.ToString) = _MainFilter
                dt.Rows(0).Item(Globals.UserProperties.TaskFilter.ToString) = _TaskFilter
                dt = BusinessLogicLayer.SystemObjects.SaveUserProperties(dt)

                _UserName = dt.Rows(0).Item("UserName")
                _LastLogin = dt.Rows(0).Item("LastLogin")
                If IsDBNull(dt.Rows(0).Item("MainFilter")) Then
                    _MainFilter = ""
                Else
                    _MainFilter = dt.Rows(0).Item("MainFilter")
                End If
                If IsDBNull(dt.Rows(0).Item("TaskFilter")) Then
                    _TaskFilter = ""
                Else
                    _TaskFilter = dt.Rows(0).Item("TaskFilter")
                End If

            Catch ex As Exception
                Throw ex
            End Try
        End Sub
        Public Sub New(ByVal vUserID As String)
            Try
                Dim dt As DataTable = BusinessLogicLayer.SystemObjects.GetUserProperties(vUserID)
                _UserID = vUserID
                _UserName = dt.Rows(0).Item("UserName")
                _LastLogin = dt.Rows(0).Item("LastLogin")
                If IsDBNull(dt.Rows(0).Item("MainFilter")) Then
                    _MainFilter = ""
                Else
                    _MainFilter = dt.Rows(0).Item("MainFilter")
                End If
                If IsDBNull(dt.Rows(0).Item("TaskFilter")) Then
                    _TaskFilter = ""
                Else
                    _TaskFilter = dt.Rows(0).Item("TaskFilter")
                End If

            Catch ex As Exception
                Throw ex
            End Try
        End Sub

        Public ReadOnly Property UserID() As String
            Get
                Return _UserID
            End Get
        End Property

        Public Property UserName() As String
            Get
                Return _UserName
            End Get
            Set(ByVal value As String)
                _UserName = value
            End Set
        End Property

        Public Property LastLogin() As DateTime
            Get
                Return _LastLogin
            End Get
            Set(ByVal value As DateTime)
                _LastLogin = value
            End Set
        End Property

        Public Property MainFilter() As String
            Get
                Return _MainFilter
            End Get
            Set(ByVal value As String)
                _MainFilter = value
            End Set
        End Property

        Public Property TaskFilter() As String
            Get
                Return _TaskFilter
            End Get
            Set(ByVal value As String)
                _TaskFilter = value
            End Set
        End Property

    End Class





End Namespace
